/*
 * @Author: 张家亮 1690608011@qq.com
 * @Date: 2022-08-18 23:11:11
 * @LastEditors: 张家亮 1690608011@qq.com
 * @LastEditTime: 2022-08-20 19:50:14
 * @FilePath: \vue-store-server\app\middleware\session.js
 * @Description: session配置
 * 
 * Copyright (c) 2022 by 张家亮 1690608011@qq.com, All Rights Reserved. 
 */
let store = {
  storage: {},
  set(key, session) {
    this.storage[key] = session;
  },
  get(key) {
    return this.storage[key];
  },
  destroy(key) {
    delete this.storage[key];
  }
}
let CONFIG = {
  key: 'koa:sess', //cookie key (default is koa:sess)
  maxAge: 86400000, // cookie 的过期时间 maxAge in ms (default is 1 days)
  overwrite: true, //是否可以 overwrite (默认 default true)
  httpOnly: true, //cookie 是否只有服务器端可以访问 httpOnly or not (default true)
  signed: true, //签名默认 true
  rolling: false, //在每次请求时强行设置 cookie，这将重置 cookie 过期时间（默认：false）
  renew: false, //(boolean) renew session when session is nearly expired,
}

module.exports = CONFIG;